import types from '../types'
import axios from 'axios'
const state = {
  goods: {}
}
const getters = {
  goods (state) {
    return state.goods
  }
}
const mutations = {
  [types.GET_GOODS] (state, data) {
    state.goods = data
  }
}
const actions = {
  getGoods ({commit, state}) {
    axios.get('/api/goods').then(resp => {
      // eslint-disable-next-line eqeqeq
      if (resp.data.errno == 0) {
        commit(types.GET_GOODS, resp.data.data)
        console.log(resp.data)
      }
    })
  }
}
export default {
  state,
  getters,
  mutations,
  actions
}
